package org.tlipoca.smarticlefavorites.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.genntii.smdomain.entity.ArticleFavorites;
import org.genntii.smdomain.vo.ArticleFavoritesCountVO;
import org.genntii.smdomain.vo.ArticleVO;

import java.util.ArrayList;

@Mapper
public interface ArticleFavoritesMapper extends BaseMapper<ArticleFavorites> {

    @Select("select * from Article_Favorites where directory_id = #{directoryId};")
    ArrayList<ArticleFavorites> selectArticleFavoritesListByDirectoryId(Long directoryId);

    @Select("SELECT  directory_id, COUNT(*) as count FROM Article_Favorites WHERE user_id = #{userId} GROUP BY directory_id")
    ArrayList<ArticleFavoritesCountVO> selectArticleFavoritesCountByUserId(Long userId);

    int existsBatch(ArrayList<Long> favoritesIds);

    void deleteBatch(ArrayList<Long> favoritesIds);
}
